package com.example.webview;

import android.os.Bundle;
import android.app.Activity;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class MainActivity extends Activity {
	private WebView webview;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_main);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        webview=(WebView) findViewById(R.id.webview);
        String data="<p>1111111</p>";
        webview.loadDataWithBaseURL(null, data, "UTF-8", null, null);
        //webview.loadUrl("file:///android_asset/hello.html");
        //webview.loadUrl("http://176.122.140.84");
        webview.setWebViewClient(new WebViewClient());
        webview.getSettings().getJavaScriptEnabled();
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
    	// TODO Auto-generated method stub
    	if(keyCode==KeyEvent.KEYCODE_BACK&&webview.canGoBack()){
    		webview.goBack();
    	}
    	return super.onKeyDown(keyCode, event);
    }
    
}
